import { defineComponent, ref } from 'vue'
import AMapCom from '@/components/AMapCom'
import { MarkerType } from '@/components/AMapCom/type'
import './index.less'
export default defineComponent({
  name: 'Home',
  setup() {
    const markers = ref<Array<MarkerType>>([])
    const centerMrk = ref<any>()
    const isHistoryData = ref<boolean>(true)
    async function getCurrentMarker(marker: any) {
      if (marker) {
        // const info: any = await getCarInfos(marker.content.id)
        // nextTick(() => {
        //   // show.value = true
        //   const car = CarData.value.filter(
        //     (v: any) => v.id === marker.content.id,
        //   )[0]
        // choseCar.value = userInfo.loginId == 'qingling' ? info : car
        // carInfos.value.topic = marker.content.topic
        // carInfos.value.Gps_ststus = marker.content.status ? '正常' : '离线'
        // carInfos.value.id = marker.content?.id
        // carInfos.value.equipmentNo = marker.content?.topic?.split('/')[3]
        // carInfos.value.license = marker.content?.license
        // carInfos.value.orgName = car?.orgName || info.orgName
        // carInfos.value.driverName = car?.driverName
        // carInfos.value.post_time = marker.content?.post_time || '---'
        // carInfos.value.position = car?.position || marker.content?.position
        // if (!carInfos.value.topic) carInfos.value.topic = marker.content.topic
        // car && getLastDatas(car.id)
        // })
      }
    }
    return () => {
      return (
        <div class="home-box">
          {/* <AMapCom
            markers={markers.value}
            centerMrk={centerMrk.value}
            onUpdate:currentMarkerId={getCurrentMarker}
            isHistoryData={isHistoryData.value}
          ></AMapCom> */}
          <span>Homew</span>
        </div>
      )
    }
  },
})
